package com.neuedu.security.controller;

import com.neuedu.security.model.RespBean;
import com.neuedu.security.model.User;
import com.neuedu.security.model.UserModel;
import com.neuedu.security.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserService userService;

    @GetMapping("/getUsers")
    public List<UserModel> getUsers(String nameKeyWords) {
        return userService.getUsers(nameKeyWords);
    }

    @DeleteMapping("/delUser/{id}")
    public RespBean delUser(@PathVariable int id) {
        return userService.delUser(id);
    }

    @PutMapping("/updateStatus")
    public RespBean updateStatus(@RequestBody UserModel user) {
        return userService.updateStatus(user);
    }
}
